﻿CREATE TABLE [dbo].[PersonaReferencia] (
    [PersonaReferenciaId]     INT          IDENTITY (1, 1) NOT NULL,
    [IntegranteId]            INT          NOT NULL,
    [Nombre]                  VARCHAR (50) NOT NULL,
    [Apellido]                VARCHAR (50) NOT NULL,
    [Telefono]                VARCHAR (50) NULL,
    [Edad]                    INT          NULL,
    [TipoPersonaReferenciaId] INT          NOT NULL,
    [VinculoId]               INT          NOT NULL,
    CONSTRAINT [PK_PersonaReferencia] PRIMARY KEY CLUSTERED ([PersonaReferenciaId] ASC) WITH (FILLFACTOR = 80),
    CONSTRAINT [FK_PersonaReferencia_Integrante] FOREIGN KEY ([IntegranteId]) REFERENCES [dbo].[Integrante] ([IntegranteId]),
    CONSTRAINT [FK_PersonaReferencia_TipoPersonaReferencia] FOREIGN KEY ([TipoPersonaReferenciaId]) REFERENCES [dbo].[TipoPersonaReferencia] ([TipoPersonaReferenciaId]),
    CONSTRAINT [FK_PersonaReferencia_Vinculo] FOREIGN KEY ([VinculoId]) REFERENCES [dbo].[Vinculo] ([VinculoId])
);



GO


GO
CREATE NONCLUSTERED INDEX [IDX_PersonaReferencia_VinculoId]
    ON [dbo].[Vinculo]([VinculoId] ASC) WITH (FILLFACTOR = 80);

GO
CREATE NONCLUSTERED INDEX [IDX_PersonaReferencia_TipoPersonaReferenciaId]
    ON [dbo].[TipoPersonaReferencia]([TipoPersonaReferenciaId] ASC) WITH (FILLFACTOR = 80);